davidpiesse / nova-map

Laravel Nova Map Field
114 stars 29 forks source link

Initial Zoom #17

Closed otrsw closed 4 years ago

otrsw commented 5 years ago

Great component!

This is not an issue - just a question. Is there a way to set the initial zoom?

davidpiesse commented 5 years ago

Just pushed to master a zoom() function for when you are building your field.

Map::make('Some Point Field', 'point_field_name')
    ->spatialType('Point')
    ->zoom(8),

Pull in from dev-master and see if it works for you :)

otrsw commented 5 years ago

Thanx for the quick feedback.

I did a an update from dev-master and I can see the new method in the Map field, so looks like I have the correct version

[cid:image001.png@01D4EA15.E012FAA0]

However the maps now don’t display at all – even if I do not include the zoom method.

[cid:image002.png@01D4EA15.E012FAA0]

Use to work perfectly, I only had to zoom in a bit 😊

[cid:image004.png@01D4EA16.24226140]

PS: Final question whilst we are chatting – I am using GeoJSON (attached) and I added title on the feature level and name on the point – but no “label” is shown on the points. Is that something in the pipeline or am I doing something wrong?

{"type": "FeatureCollection", "features": [{"type": "Feature", "title": "GATTI'S ICE CREAM (PTY) LTD (SH858075)", "geometry": {"type": "Point", "coordinates": ["18.51113200", "-33.98994600"]}, "properties": {"name": "GATTI'S ICE CREAM (PTY) LTD (SH858075)"}}, {"type": "Feature", "title": "Fairbrother Geotechnical Engineering (SH858077)", "geometry": {"type": "Point", "coordinates": ["18.48134830", "-34.04187420"]}, "properties": {"name": "Fairbrother Geotechnical Engineering (SH858077)"}}, {"type": "Feature", "title": "ATTORNEYS INSURANCE INDEMNITY FUND (SH858079)", "geometry": {"type": "Point", "coordinates": ["18.41872940", "-33.92378200"]}, "properties": {"name": "ATTORNEYS INSURANCE INDEMNITY FUND (SH858079)"}}, {"type": "Feature", "title": "UNITRANS AUTOMOTIVE (PTY) LTD (SH858081)", "geometry": {"type": "Point", "coordinates": ["18.61202000", "-33.90169400"]}, "properties": {"name": "UNITRANS AUTOMOTIVE (PTY) LTD (SH858081)"}}, {"type": "Feature", "title": "CAPE TOWN CENTRAL CITY IMPROVEMENT DISTRICT CC (SH858083)", "geometry": {"type": "Point", "coordinates": ["18.42353600", "-33.91894100"]}, "properties": {"name": "CAPE TOWN CENTRAL CITY IMPROVEMENT DISTRICT CC (SH858083)"}}]}

Regards Heinz

From: David Piesse notifications@github.com Sent: Wednesday, April 3, 2019 10:39 AM To: davidpiesse/nova-map nova-map@noreply.github.com Cc: Heinz Seldte heinz@otrsw.com; Author author@noreply.github.com Subject: Re: [davidpiesse/nova-map] Initial Zoom (#17)

Just pushed to master a zoom() function for when you are building your field.

Map::make('Some Point Field', 'point_field_name')

->spatialType('Point')

->zoom(8),

Pull in from dev-master and see if it works for you :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/davidpiesse/nova-map/issues/17#issuecomment-479395345, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APQJuNXQEkdqoffYqujdRfl_LKo0d9RHks5vdGiWgaJpZM4cZwrw.

davidpiesse commented 5 years ago

Odd! Are you using the exact same code as before ( without zoom() ) and it is still not showing? Are there any console errors?

As for the labels - that isn't currently a feature but you are more than welcome to add it and submit a PR.

D

JJCLane commented 4 years ago

@davidpiesse I tested the latest release and the zoom works as expected, you can close this issue if you'd like.