Discussion about implementing geojson into a plugin using Google Maps or Leaflet

16 replies
Last updated: Apr 7, 2020
Espen Hovlandsdal
do you take requests for features in a plugins you have made? 🙂
AI Update

Yes! Sanity team members and plugin authors are generally very open to feature requests. Here are the best ways to request features for Sanity plugins:

For official Sanity plugins:

For community plugins:

  • Check the plugin's repository for a GitHub issues section
  • Reach out to the author directly if they've provided contact information

Since Espen Hovlandsdal is a core Sanity team member and has created many popular plugins (like the portable text editor, image plugin, and others), you can:

  • Tag him in the Sanity Slack workspace
  • Open issues on the specific plugin's GitHub repo
  • Mention him in GitHub discussions

When making feature requests, it helps to:

  • Describe your use case and what problem you're trying to solve
  • Explain why the current functionality doesn't meet your needs
  • Provide examples or mockups if applicable

The Sanity team is known for being responsive to community feedback, and many features have been implemented based on user requests. Even if a feature can't be added immediately, the discussion often leads to workarounds or alternative solutions.

Sure? 🙂
🙂 I’m looking on how to implement geojson (for polygon) into my studio, hopefully using the google-maps-input plugin. and I think by adding the drawing layer from https://developers.google.com/maps/documentation/javascript/drawinglayer#overview this could be achieved. In addition to the possibility to remove points https://developers.google.com/maps/documentation/javascript/examples/delete-vertex-menu
maybe if this could be activated on a geojson field or something, to seperate it from geopoint
Im sure its a lot to consider and quite some work to implement correctly, but one can only ask and hope that is a interesting challenge 🙂
Oh interesting. That would certainly be a possibility, but I'm thinking it might make sense to create a separate input component for it, given it has different constraints and would need a different schema type.
I have actually implemented a fair amount of this in a side project I have going (screenshot attached) but it's using Leaflet with Mapbox for tiles.
I've not yet implemented the actual editing of the path, but I have it on my list of things that I want to add (sometimes the GPS gets a little spotty and the paths are off, so I'd like to correct the path manually)
I also kind of like working with Leaflet and the surrounding tools better than Google Maps - I've already got things like path "normalization" in place (reduces the number of points to a smaller subset if they are very similar/follows a straight line)
The schema type for this particular case is simply:
{
  name: 'geoPath',
  title: 'Geo path',
  type: 'object',
  fields: [
    {
      name: 'points',
      title: 'Points',
      type: 'array',
      of: [{type: 'geopoint'}]
    }
  ]
}
And then I apply a custom input component to it, currently only for
showing the path
While we do theoretically support storing multidimensional arrays, there isn't a good way to query it currently, and the Sanity schema will/should complain if you try to put an array in an array, so I've opted for "close to GeoJSON but not quite GeoJSON"
🙂
That looks really cool
leaflet vs google maps is the same in the studio bit for my part. I assume its not much different output with regard to how precise they are
For my particular usecase i wouldn’t query the data inside the geojson, just the geojson object in itself. Would it be way too dirty storing it stringified?
hmm, actually this way of storing it would be better. can easily be converted to geojson before consumption
Stringified is justd a bit of a pain to work with, I'd rather be able to use the Sanity patch mutations and stuff 🙂
This is what I was hoping to use for editing operations, for reference: https://github.com/Leaflet/Leaflet.Editable

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?