File tree Expand file tree Collapse file tree 3 files changed +25340
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25340
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ This map field currently ONLY shows in details view - BUT editing will be coming
77You can use this Map Field with three different sort of spatial data:
88* GeoJSON String property
99* Latitude and Longitude properties
10+ * Latitude and Longitude both in a single text field
1011* Core Laravel Spatial Types
1112 * Point
1213 * LineString
@@ -31,6 +32,7 @@ To specify what sort of spatial data you are passing to this field you MUST set
3132```
3233These are the valid Spatial Types
3334* LatLon
35+ * LatLonField (single field)
3436* GeoJSON
3537* Point
3638* LineString
@@ -71,6 +73,12 @@ Map::make('Some Point Location')
7173 ->longitude('longitude_field_name'),
7274```
7375
76+ ## Latitude & Longitude (in single fields)
77+ ``` php
78+ Map::make('Some Point Location', 'coordinate_field_name')
79+ ->spatialType('LatLonField'),
80+ ```
81+
7482## Set the Height
7583``` php
7684Map::make('Some Point Field', 'point_field_name')
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -97,6 +97,15 @@ export default {
9797 this .value [this .latitude_field ],
9898 ]
9999 }
100+ }else if (this .type == " LatLonField" ){
101+ let coords = this .value .split (/ [ ,] + / ).filter (Boolean );
102+ return {
103+ type: ' Point' ,
104+ coordinates: [
105+ coords[1 ],
106+ coords[0 ]
107+ ]
108+ }
100109 }else if (this .type == " GeoJSON" ){
101110 return JSON .parse (this .value )
102111 }else {
@@ -105,7 +114,6 @@ export default {
105114 }
106115 },
107116 mounted () {
108-
109117 this .$nextTick (() => {
110118 this .map = this .$refs .map .mapObject
111119
You can’t perform that action at this time.
0 commit comments