Is anyone interested in drawing geojson maps?

TILogistic

Expert
Licensed User
Longtime User
You can use several tools to work with GeoJSON databases, including:
Azure Cosmos DB: Add geographic objects to containers using the Azure Cosmos DB SDK
Elasticsearch: Use Kibana to index GeoJSON files in Elasticsearch and display the data on a map
ArcGIS GeoEvent Server: Use the "Receive GeoJSON at a REST endpoint" input connector to receive and adapt GeoJSON event data
PostGIS: Use the PostGIS extension on the open-source Postgres database to store tables
Turf.js: Use Turf.js to manipulate GeoJSON data in JavaScript
Leaflet: Use the L.geoJSON() method to integrate GeoJSON data into Leaflet maps

GeoJSON Overview
GeoJSON is an open standard format for representing geographic data structures. It is based on JavaScript Object Notation (JSON). GeoJSON supports point, linestring, polygon, and multipart features. GeoJSON use cases:
Describing service coverage for mobile routing and navigation applications
Visualizing large data sets to identify trends and patterns
Displaying the outline of an area, such as a park, lake, or building
GeoJSON has some limitations, including:
Lacks support for topological relationships
Imposes some limitations on the complexity and size of attribute data
 
  • Like
Reactions: byz

byz

Active Member
Licensed User
If you are only targeting desktops then it can be implemented with PyBridge and GeoPandas quite easily.
I will go and find out.however I hope both b4a and b4j can be used.I have currently tried using b4xcanvas and have not received any effective results,I think it's because I'm not familiar enough with using Canvas.Recently, I have been searching for possible solutions on the forum. Both b4xcanvas and bitmap creator seem to have the potential to do this.
 

byz

Active Member
Licensed User
You can use several tools to work with GeoJSON databases, including:
Azure Cosmos DB: Add geographic objects to containers using the Azure Cosmos DB SDK
Elasticsearch: Use Kibana to index GeoJSON files in Elasticsearch and display the data on a map
ArcGIS GeoEvent Server: Use the "Receive GeoJSON at a REST endpoint" input connector to receive and adapt GeoJSON event data
PostGIS: Use the PostGIS extension on the open-source Postgres database to store tables
Turf.js: Use Turf.js to manipulate GeoJSON data in JavaScript
Leaflet: Use the L.geoJSON() method to integrate GeoJSON data into Leaflet maps

GeoJSON Overview
GeoJSON is an open standard format for representing geographic data structures. It is based on JavaScript Object Notation (JSON). GeoJSON supports point, linestring, polygon, and multipart features. GeoJSON use cases:
Describing service coverage for mobile routing and navigation applications
Visualizing large data sets to identify trends and patterns
Displaying the outline of an area, such as a park, lake, or building
GeoJSON has some limitations, including:
Lacks support for topological relationships
Imposes some limitations on the complexity and size of attribute data
I hope to load geojson files in b4x so that I can draw maps and support interaction.
 

klaus

Expert
Licensed User
Longtime User
I have currently tried using b4xcanvas and have not received any effective results
I have been searching for possible solutions on the forum. Both b4xcanvas and bitmap creator seem to have the potential to do this.
What exactly do you want to do ?
What kind of maps do you want to draw ?
 

byz

Active Member
Licensed User
What exactly do you want to do ?
What kind of maps do you want to draw ?
hi klaus,geojson It saves many geometric features and some geographic information(An array composed of many numbers) in JSON format.I want to draw a map(like mini google map) based on it, such as a certain country or province.Simultaneously supporting clicking on different areas to highlight a certain area and making more interactions.I'm sorry if I didn't express myself clearly.These English are translated.

This is the explanation and standard of Wikipedia.


This is an intuitive example
example:
 

byz

Active Member
Licensed User
It might become a big project.
But, can you post your test project, to see what you have already done ?
Of course, Klaus, the test project was added to the attachment, and so far I've only finished parsing geojson. This is my first version, and now I think my thinking may be right, but the data structure probably needs to be improved (currently plotting will give errors).By the way, the comments are in Chinese and need to be converted to English.
 

Attachments

  • GEOjson测试.zip
    255.4 KB · Views: 99

klaus

Expert
Licensed User
Longtime User
I had a look at your project.
You are beginning with a quite huge GeoJSON file, more than 100000 lines and directly with Multipolygons. a big challenge.
It would be easier to begin with simpler data.

Now, your project:
It seems to me that the JSON parsing is not OK.
In the DrawPolygon(Polygon As Lint) routine, if you look at the structure of ps1 you do not get the coordinates.
The structure is more complicated.

1744204906921.png


Then to draw with a B4XCanvas you need a Pane / Panel as a B4XView and a B4XCanvas pointing the the Panel.
And for the drawing you need also a scale to transform the geo coordinates to pixel coordinates.
I have begun to make a small drawing program for geo coordinates as a demonstrator.
I will let you know how it is going further.
 

byz

Active Member
Licensed User
Thank you very much, klaus! I offer some of my thoughts in the hope of saving you time.And point out my mistakes.
The debugging mode in the screenshot looks great and practical, I actually forgot to use this practical feature.My terrible structure is clear at a glance.
My idea is to ultimately add all regions to a list with only one layer, such as when displaying a world map, the list only includes countries and not provinces.This is done for interactive functions such as adding events and detecting which country the point is located in.
If you click on a country, you will enter its map and continue clicking until you reach my village,It can be achieved by loading n geojson files.
Regarding the analysis of polygons, I mentioned an important point in the comments,That's the enclave issue.One region may be within another region, such as the Vatican in Italy.Or a certain region of a country within another country (just a geographical expression, not involving history or politics Or religion, etc),For example, the capital of China is located within Hebei Province, and there are also two enclaves in Hebei Province.The drawing and interaction of enclaves is also a challenge.
 

byz

Active Member
Licensed User
TILogistic,Your work is great.I see that it is implemented using JavaScript.I am not very good at JavaScript, and the scope of my exposure is all related to local machine interaction,Therefore, I hope to use b4x for it.

I have another idea, but I haven't figured out how to implement it yet.It is to develop a 3D model interaction program in B4X. It can be used in conjunction with geojson.By the way, the community already has a packaging library for Three.js and OpenGL, but there are still relatively few examples, and I don't know how to do it yet.
 

klaus

Expert
Licensed User
Longtime User
I have begun to write a demonstrator to show what could be done.
Attached the project of a CustomView drawing geo objects.
Tested only with B4J.
If you want to continue with this it might become a big project.

1744643217301.png
 

Attachments

  • GeoJSON.zip
    20.1 KB · Views: 91
Top