-1

I'm currently working on a proof-of-concept where we're using an Azure Database as our data storage. I've got one table in there containing a few bits of information, and a geometry column (geometry is all multipolygons).

Now, we'd like to be able to both see and edit these geometries in Azure Maps. From my Googling, it seems that you can't just "hook" the two together - there has to be some intermediary, which is fair enough. I've written a node.js file, currently local on my PC, which can query the data (currently filters on a field, but it'd be easy to send a bounding box).

I guess my question is "what is the recommended way to get Azure Maps and Azure Database talking?" If the preferred method is a node.js, I take it I then need to create a json/geojson from the result and have that displayed in Azure Maps, but how would I go about that? And how would I send/post information back?

I'd also like to stay as clear of Visual Studio as I can, and preferably have a lightweight solution.

user25730
  • 517
  • 2
  • 6
  • 24

1 Answers1

1

You need a simple service to pass the data from your database to your client application. From there you can overlay the data on the map. An Azure function is a nice simple solution, but its also fairly easy to create a REST service within an Azure Web app. There is no one architecture recommendation as there is hundreds of valid options/paths that can be taken, some better than others depending on your scenario (i.e. SignalR is better for streaming data sets). I would recommend using what you are most familiar with. Here are a couple of simple approaches:

https://markheath.net/post/azure-functions-rest-csharp-bindings

https://devblogs.microsoft.com/azure-sql/rest-api-with-azure-functions-javascript-and-azuresql/

If creating a web app, then passing the data as JSON at a minimum would be ideal, GeoJSON would be even easier and require no transformation of the service response before adding to the map, but may result in larger response sizes (may not matter depending on the number of results in your response).

If using JSON (not GeoJSON), you can convert your geometry to a Well Known Text string, the ToString or equivalent method in spatial databases will generate this for you. You can then use the Spatial IO module for Azure Maps to parse this into GeoJSON within the client app.

rbrundritt
  • 16,570
  • 2
  • 21
  • 46
  • Thank you, I've got a bunch of other work that's suddenly materialised but will try this when I get the chance and mark as answer when working. Just didn't want you to feel I'd forgotten :) – user25730 May 12 '21 at 22:08