I have a database and web server filled with values for particular countries. I want to be able to display an interactive map that is color coded based on the values from my database upon querying it. (By interactive, I mean a simple zoom-in and move-around feature is all that is needed).
I have the shape files (.shp) of the world, and can easily get KML files as well. This all needs to be done in JavaScript/JQuery (using JQuery to grab the data from the database) and then apply a color code scheme to the shape file (fill in the country borders).
What would be a good JavaScript library to use for this? I have looked into OpenLayers but am unsure it can do what I need (perhaps I haven't dug deep enough).
It sounds like Leaflet.js would be another great option for you. Making choropleth maps in Leaflet is very easy and intercity (zooming) is standard.
You might try D3.js, which is a great framework in general, and has some basic Choropleth support, though I'm not sure how well it works natively with your existing files.
Check out:
http://mbostock.github.com/d3/ex/choropleth.html
Related
I'm currently working on a project to display enriched geographical data within an interactive map. For example, I have housing blocks with additional information added, and I want to display this data within an interactive map. I chose google maps, because I don't have any experience in building a map-based webservice and google seemed to be easy accessible and working.
The problem comes with the amount of information i have. A single town like Berlin has about 450.000 geometrys, which results in a GeoJSON file roughly 170MB big. I know, that this isn't anywhere near to working.
Do you guys can give me a hint on how to structure the project? What kind of technology can I use to dynamically query the needed data? Are there any libraries or working solutions that I should give a try?
How I solved this issue:
I used mapnik to pre-render the tiles and displayed them in google maps using getTileURL. I used this tutorial, which explains the basics on how to use mapnik for google map tiles.
I am wondering if it's possible to use a shapefile with point features in arcmap as a web map?
I have seen examples, however most of them project the shapefile on top of a base layer map, for example, Google maps or ESRI maps. I am purely wanting to use the shapefile as a web map that supports zoom? Is this possible? If so, how would I go about achieving this?
The only method I can think of so far is to save the shapefile as a service to arcGIS for server...
Any guidance and help will be very helpful.
Thanks in advance.
You could start off by importing the shapefile into TileMill. Once you have styled the layer, you could export it as an MBTile and serve it with Mapbox.
I also found this description that you might find helpful.
http://blog.thematicmapping.org/2012/11/exploring-mapbox-stack-mbtiles-tilejson.html
Good Luck.
If there aren't too many points (more than a few hundred) then you probably want to generate GeoJSON from the shapefile and display the data that way.
You can convert your shapefile to geojson with the GDAL library.
ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp
If there are more than a few hundred points, then I'd use #andrewGeo's strategy.
The easier thing to do would be to share the shapefile from a server like ArcGIS Server or GeoServer. GeoServer tends to be easier to share something simple, especially if you use the Boundless Geo (http://boundlessgeo.com/). That comes with GeoExplorer which can directly consume a shapefile from GeoServer.
Depending on the API you're using to generate the basemap, you can hardcode x/y information into it or consume a KML/KMZ. These tend to be tedious and not great if you're doing more than just viewing static data.
If you choose the server option, beware about hosting and consuming your data on the same server. You may run into Cross Domain issues and life becomes a little more complex then. I believe GeoExplorer automatically bypassed any issues I had with Cross Domain, but most of the other JavaScript APIs were a little more troublesome.
With the release of QGIS 3.8 there is new feature to generate raster MBTiles layers. Once the layer you want to convert is setup, you can open up the Toolbox by either selecting the gear icon or by going into the processing tab on the menu bar and selecting toolbox. Then in the Processing Toolbox, drill-down into the Raster Tools section. Within this section, select the Generate XYZ tile (MBTiles) option. Then you can serve it into mapbox (currently GeoServer does support serving MBTiles as well by installing the MBTiles extension)
Here is a reference to this with a straight forward and well-illustrated example on how to use this new QGIS feature.
Lately I have been working on a indoor navigation project for a school. It all works but I think it can be faster and easier to edit, so I began searching and came upon iD editor (which is made (?) by OpenStreetMap).
It looks very good. The only thing I can't find is if I can use it with my own maps.
Does anyone know if it is possible, and if not, does anyone know an alternative?
Thanks in advance,
Lars Jansen
The Netherlands
If you just need a simple overlay with some markers or routes then you can use Leaflet or OpenLayers.
It is also possible to create a completely personal map, but it will require to set up a complete backend. iD is just the editor. If you want to see the resulting map in you browser you will need:
a postgres database for storing the map data
a renderer for creating images (tiles) from this database, for example Mapnik
a java script library like Leaflet or OpenLayers for creating a browsable map from the rendered tiles
possibly a geocoding service like Nominatim if you need a search function
As you can see, OSM's main goal is not to create personal maps. Still it is possible but requires some effort to set it up (switch2osm has some useful guides).
Also take a look at similar questions on help.openstreeetmap.org, including possible alternatives:
https://help.openstreetmap.org/questions/27621/personalised-maps
https://help.openstreetmap.org/questions/22827/using-id-editor-to-for-personal-alternative-maps
https://help.openstreetmap.org/questions/11069/does-openstreetmap-have-a-my-places-feature-like-google-maps
https://help.openstreetmap.org/questions/24591/create-my-own-addresses-roads-and-ways-on-a-custom-world-map
https://help.openstreetmap.org/questions/4496/how-to-create-fantasyimaginary-maps-with-openstreetmap
I'm not familiar with this editor specifically, but there are generally two ways to add custom maps:
Image overlay: for OSM it looks like its called Open Layers: http://wiki.openstreetmap.org/wiki/OpenLayers
Custom WMS source: probably overkill - although it looks like partial local caches are supported- so that might be just what you're after: http://wiki.openstreetmap.org/wiki/Creating_your_own_tiles
Sorry I can't help more- good luck!
I'm looking to use this chart generation library: http://www.jqchart.com/
Ideally, I would prefer to use a PHP charting library for the current project I'm working, but, by the looks of it, this is the only library I've found that can handle what I need to do (given a somewhat unconventional requirement for the charts).
The issue is that I need to get the generated graphs as images (at the moment each graph seems to be a combination of images) to the server so that I can generate some PDF documents, etc.
I'm thinking of attempting to create an image using JS, pushing this back to the server and then generating the PDF although this pretty nasty and will probably cause issues between different versions of the browser.
So now what I'm looking for is a solution that will allow me to generate the graphs and turn them into images on the backend.
Any ideas?
EDIT: For the requirement that led me to rule out a number of other charting libraries, see here: Complex charts in Google Charts
That really isn't all that relevant to the question of processing Javascript on the server, though.
You can render a javascript graph on the server using phantomjs. Here is an example.
Not sure what your requirements are, but I'd check out Google Chart Tools: http://code.google.com/apis/chart/. It's really simple to use. All the data is in the image URL get request, so you can generate charts using client-side JavaScript too.
I am trying to create functionality like can be found in this example...
http://googlemapsapi.blogspot.com/2008/05/love-my-maps-use-its-line-and-shape.html
Where the user of the page can draw a polygon on the map by clicking to create the points in the polygon. It seems like all the examples I'm finding of this functionality are in v2 of the API and whenever I try to mimic such functionality using v3 I get a bunch of errors saying objects don't exist and so on. Is it possible to create this same functionality using v3 of the framework? Or will I have to use v2 of the framework.
Thanks
There was a lot of namespaces and object names that changed from v2 to v3, so you won't be able to use the code as it is. But it's not only a name change that is required, the functions have changed slightly as well. I'm pretty sure you won't be forced to use v2 to draw lines, although it will take some effort to copy the functionality to a v3 app.