Skip to content

Commit 4a98583

Browse files
committed
fresh classes from slightly different proto file
1 parent b1e9511 commit 4a98583

File tree

12 files changed

+679
-394
lines changed

12 files changed

+679
-394
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# php-geobuf
2+
3+
PHP class for the geobuf compact geospatial format
4+
5+
## Installation
6+
7+
```bash
8+
composer require mbolli/php-geobuf
9+
```
10+
11+
## Usage
12+
13+
```php
14+
15+
```
16+
17+
## Background: Proto compilation
18+
19+
Classes were generated by the [proto compiler](https://developers.google.com/protocol-buffers) using this command:
20+
21+
```bash
22+
bin/protoc --proto_path=src --php_out=build src/geobuf.proto
23+
```
24+
25+
And [this proto file](./geobuf.proto) (lightly modified from the [mapbox/geobuf proto file](https://github.com/mapbox/geobuf/blob/master/geobuf.proto) for proto3 compatibility).

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mbolli/phpgeobuf",
2+
"name": "mbolli/php-geobuf",
33
"description": "PHP class for the geobuf compact geospatial format",
44
"type": "library",
55
"license": "ISC",
@@ -10,11 +10,14 @@
1010
}
1111
],
1212
"require": {
13-
"google/protobuf": "^3.19"
13+
"google/protobuf": "^3.19",
14+
"ext-json": "*",
15+
"php": "^7.3 || 8.0"
1416
},
1517
"autoload": {
1618
"psr-4": {
17-
"MBolli\\PhpGeobuf\\": "src/"
19+
"MBolli\\PhpGeobuf\\": "src/",
20+
"GPBMetadata\\": "src/GPBMetadata"
1821
}
1922
}
2023
}

geobuf.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
syntax = "proto3";
22
option optimize_for = LITE_RUNTIME;
3+
package MBolli.PhpGeobuf;
34

45
message Data {
56
repeated string keys = 1; // global arrays of unique keys
67

7-
optional uint32 dimensions = 2; //[default = 2]; // max coordinate dimensions
8-
optional uint32 precision = 3; //[default = 6]; // number of digits after decimal point for coordinates
8+
uint32 dimensions = 2; //[default = 2]; // max coordinate dimensions
9+
uint32 precision = 3; //[default = 6]; // number of digits after decimal point for coordinates
910

1011
oneof data_type {
1112
FeatureCollection feature_collection = 4;

src/Data.php

Lines changed: 246 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)